package com.gaga.metadata.common.enums;

/**
 * DbFilterOperatorType
 **/
public enum DbFilterOperatorType {
    EQUAL("=", "等于"),
    NOTEQUAL("!=", "不等于"),
    GREATTHAN(">", "大于"),
    LESSTHAN("<", "小于"),
    GREATEQUAL(">=", "大于等于"),
    LESSEQUAL("<=", "小于等于"),
    IN("in", "包含");

    private String code;
    private String desc;

    DbFilterOperatorType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static DbFilterOperatorType ofCode(String oprCode) {
        for (DbFilterOperatorType dbOperatorType : values()) {
            if (dbOperatorType.code.equalsIgnoreCase(oprCode)) {
                return dbOperatorType;
            }
        }
        return null;
    }

}
